<!DOCTYPE html> 
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no"/>
<title>我的收藏</title>
<link href="jquery-mobile/jquery.mobile.min.css" rel="stylesheet" type="text/css"/>
<script src="jquery-mobile/jquery.min.js" type="text/javascript"></script>
<script src="jquery-mobile/jquery.mobile.min.js" type="text/javascript"></script>

<script src="js/cordova.js" type="text/javascript"></script>
<script src="js/getcollection.js" type="text/javascript"></script>
<script type="text/javascript" src="js/jquery.raty.js"></script>

<style type="text/css">
a.delete {
	display: none;
	width: 80px;
	height: 30px;
	background-color: #F37873;
	color: white;
	padding: 8px 10px;
	font-weight: bold;
	text-decoration: none;
	cursor: pointer;
	margin-right: 10px;
	margin-left: -75px;
	-moz-border-radius: 5px;
	-webkit-border-radius: 5px;
	-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
	-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
	text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.25);
	font-size: 12pt;
  background-image: -webkit-linear-gradient(top, #F37873 0%, #DB504D 50%, #CB0500 50%, #A20601 100%);
	background-image: -moz-linear-gradient(top, #F37873 0%, #DB504D 50%, #CB0500 50%, #A20601 100%);
	background-image: -ms-linear-gradient(top, #F37873 0%, #DB504D 50%, #CB0500 50%, #A20601 100%);
	background-image: -o-linear-gradient(top, #F37873 0%, #DB504D 50%, #CB0500 50%, #A20601 100%);
	background-image: linear-gradient(top, #F37873 0%, #DB504D 50%, #CB0500 50%, #A20601 100%);
}

#main {
	background:url("img/back.jpg") repeat;
}

td#wrap_delete{
	width: 0px;
}

</style>

<script type="text/javascript">
function back(){
	if (typeof(navigator) != 'undefined' && typeof(navigator.app) != 'undefined' && typeof(navigator.app.backHistory) == 'function') {
		navigator.app.backHistory();
	} else{
		history.back();
	}
}

$(document).ready(function(){
	$('.ui-btn-back').live('tap',function() {
	back();
	return false;
}).live('click',function() {
	back();
	return false;
});
	$("#content").css("min-height", document.body.clientHeight - $("#content").offset().top);
	//$("#wrap_delete").css("min-width", $("table").width());
	//$("#wrap_delete").css("height", $("table").height());
	//getGPS();
	
	jQuery('body').live('swipeleft',function(event){
		back();
		//event.preventDefault();
	});
	jQuery('body').live('swiperight',function(event){
		window.history.forward();
		//event.preventDefault();
	});
});

function edit(e){
	node = e.target
	if (node.innerText == "编辑") {
	  $("a.delete").css("display", "inline");
	  $("table").css("color", "gray");
	  node.innerText = "完成";
	} else {
		$("a.delete").css("display", "none");
		$("table").css("color", "");
		node.innerText = "编辑";
	}
}

//ajax 删除收藏的商户
function shopDelete(e, shopid){
	var arg=$("#shopIdType"+shopid).html();
	a=arg.split("#");
	uid=a[0];
	shopid=a[1];
	type=a[2];
	$.ajax({type:'POST',async:false, url:'http://ihavecar.sinaapp.com/deletecollect.php?shopid='+shopid+'&type='+type+'&userid='+uid});	/*$.getJSON('http://ihavecar.sinaapp.com/collection.php?jasoncallback=?&randomID='+Math.random(), function(json){
		//random函数用来取消缓存影响,jsonp形式进行跨域传数据
			$.each(json,function(entryIndex,entry){
				
			});
		}); */
		
	tr = e.target.parentNode.parentNode;
	table = tr.parentNode;
	table.removeChild(tr);
}

</script>

</head>

<body>

<div id="main" data-role="page">
 <div data-role="header"  data-theme="b">
    <a href="#" class="ui-btn-back">返回</a>
    <h1>我的收藏</h1>
    <a href="#" onclick="edit(event)">编辑</a>
 </div>
 <div  data-role="content" id="content">
    <div id="collection"></div>
 </div>

 
<script type="text/javascript">
var url=window.location.href;
var arg1=url.split("=");
var uid=arg1[1];
getcollection(uid); 
</script>
</div>

</body>
</html>